<?php

namespace App\Models;

class HousingsNum extends Model
{
    protected $fillable = [
        'field_name',
    ];

    protected $table = 'housings_num';
    protected $colour = [1=>'蓝色',2=>'绿色',3=>'黄色',4=>'红色'];
    public function getColourAttribute($value)
    {
        return isset($this->colour[$value]) ? $this->colour[$value] : reset($this->colour);
    }

    public function housings()
    {
        return $this->hasOne(Housings::class,'id','housings_id')->select("id",'landlord_name','landlord_idcard','landlord_phone','hou_address','type');
    }
}
